import 'package:dio5_log/overlay_draggable_button.dart';
import 'package:flutter/material.dart';
import 'package:hxdj/common/components/my_clip_rect.dart';
import 'package:hxdj/common/components/my_tap_widget.dart';
import 'package:hxdj/common/env_config/env.dart';
import 'package:hxdj/common/my_common.dart';
import 'package:hxdj/common/my_constant.dart';
import 'package:hxdj/common/my_header_global.dart';
import 'package:package_info_plus/package_info_plus.dart';

class AboutMinePage extends StatefulWidget {
  static String routeName = "/MinePage";

  const AboutMinePage({super.key});

  @override
  State<AboutMinePage> createState() => _AboutMinePageState();
}

class _AboutMinePageState extends State<AboutMinePage> {
  String buildNumber = "";
  int count = 0;
  @override
  void initState() {
    super.initState();
    getVersion();
  }

  getVersion() async {
    PackageInfo packageInfo = await PackageInfo.fromPlatform();
    CommonPlugin.version = packageInfo.version;
    buildNumber = packageInfo.buildNumber;

    setState(() {});
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        backgroundColor: Colors.white,
        appBar: const MyAppBar(title: "关于我们"),
        body: SingleChildScrollView(
          child: Container(
              margin: EdgeInsets.only(top: 120.w),
              alignment: Alignment.center,
              child: Column(
                children: [
                  MyTapWidget(
                      onTap: () {
                        count++;
                        if (count > 7) {
                          CommonPlugin.sharedPreferences?.setBool(MyConstant.isTest, true);
                          showDebugBtn(context, btnColor: MyColours.appMain, btnSize: 50);
                        }
                      },
                      child: MyClipRect(imageName: "ic_app", width: 100.w, radius: 10.w)),
                  Env.envCode == EnvCode.ft1
                      ? Container(
                          margin: EdgeInsets.only(top: 12.h),
                          child: Text(
                            "当前版本：${CommonPlugin.version} $buildNumber",
                            style: TextStyle(
                                fontSize: 13.sp,
                                fontWeight: FontWeight.w700,
                                color: const Color.fromRGBO(44, 44, 44, 1)),
                          ),
                        )
                      : Container(),
                  Container(
                    margin: EdgeInsets.only(top: 14.h),
                    child: Container(
                      padding: EdgeInsets.symmetric(horizontal: 30.w),
                      child: Text(
                        "欢心按摩是国内专业的24小时上门按摩平台， 运营期间已开通多个城市；平台覆盖范国广泛， 服务者资源丰富并且全部实名认证、资质认",
                        style: TextStyle(
                            fontSize: 15.sp, fontWeight: FontWeight.w400, color: const Color.fromRGBO(44, 44, 44, 1)),
                      ),
                    ),
                  ),
                ],
              )),
        ));
  }
}
